{if $full_page}
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>{$title}</title>
<link rel="stylesheet" href="Res/boot/css/bootstrap.min.css" type="text/css" media="screen" />
<link rel="stylesheet" href="Res/boot/css/bootstrap-theme.min.css" type="text/css" media="screen" />
<script type="text/javascript" src="Res/js/jquery-1.11.3.min.js"></script>
<script type="text/javascript" src="Res/js/jquery.cookie.js"></script>
<script type="text/javascript" src="Res/boot/js/bootstrap.min.js"></script>
<script type="text/javascript" src="Res/js/listTable.js"></script>
<link rel="stylesheet" href="Res/css/page.css" type="text/css" />
<link rel="stylesheet" href="Res/css/global.css" type="text/css" />
<script type="text/javascript" src="Res/js_time/laydate.js"></script>
{literal}
<style>
    .listDiv{margin:0 auto;}  
    table tbody td span:hover{background-color:#00E8D7;font-weight: 100;}
</style>
{/literal}
</head>
<body>
<div class="container-fluid">
	<div class="row-fluid">
            <div class="span12 panel panel-info">                
                <span class="cp_title">代碼管理</span>
                <div class="add_cp">
                        <a href="index.php?c=code&m=create">+添加代碼</a>
                </div>	
                <div class="panel-heading">
                    <label for="user_name">用户名称:</label>
                    <input class="input-medium search-query" id="user_name" name="user_name" type="text" placeholder="用户名称" />  
                    
                    <label for="user_name">APPID:</label>
                    <input class="input-medium search-query" id="appid" name="appid" type="text" placeholder="APPID" />  
                    
                    <label for="user_name">APPKEY:</label>
                    <input class="input-medium search-query" id="appkey" name="appkey" type="text" placeholder="APPKEY" />   
                    
                    <label for="start_time">开始时间:</label>
                    <input class="form-group-sm laydate-icon" id="start_time" name="start_time" type="text" placeholder="开始时间" />   
                    
                    <label for="end_time">结束时间:</label>
                    <input class="form-group-sm laydate-icon" id="end_time" name="end_time" type="text" placeholder="结束时间" />   
                    
                    <button type="button" id="btn_search" class="btn btn-success">查找</button>                        
                </div>
 
                <div class="listDiv" id="listDiv">
{/if}
                <table id="data_table_id" class="table table-hover table-bordered">
                    <thead>
                    <tr>                        
                        <th><a href="javascript:listTable.sort('code_id', 'DESC');" title="点击对列表排序">ID</a>{$sort_code_id}</th>
                        <th>用户名</th>
                        <th>代码名称</th>
                        <th>APPID</th>
                        <th>APPKEY</th>
                        <th>最後訪問时间</th>
                        <th>訪問次数</th>
                        <th>是否使用</th>
                        <th>代码URL</th>
                        <th>操作</th>
                    </tr>
                    </thead>
                    <tbody>    
                        {foreach from=$data.pageData item=row}
                        <tr>
                            <td>{$row.id}</td>
                            <td>{$row.user_name}</td>
                            <td><span onclick="listTable.edit(this, 'edit_fields', {$row.code_id}, 'code_name')" title="点击修改">{$row.code_name}</span></td>
                            <td>{$row.appid}</td>
                            <td>{$row.appkey}</td>
                            <td title="創建時間{$row.in_time_format}">{$row.last_time_format}</td>
                            <td>{$row.visit_count}</td>
                            <td style="text-align:center;">
                                <label class="glyphicon {$row.is_use}" style="cursor:pointer;font-size: 16px;line-height: 28px;" onclick="listTable.toggle(this, {$row.code_id}, 'is_use')"></label>
                            </td>                            
                            <td>{$row.code_url}</td>
                            <td style="text-align:center;">          
                                <button class="btn btn-info" title="此操作真的移除，無法挽回，慎重(您還可以停用)" type="button" onclick="listTable.remove({$row.code_id}, '此操作真的移除，無法挽回，慎重(您還可以停用)')">
                                    <span class="glyphicon glyphicon-remove-circle"></span>
                                </button>
                            </td>
                        </tr>
                        {/foreach}
                    </tbody>
                    <tfoot>
                        <!-- 分页数据 -->
                        <tr>
                            <td colspan="10"><div class="iPageHtml">{$data.pageHtml}</div></td>
                        </tr>
                    </tfoot>
                </table>
              
{if $full_page}
                </div>
            </div>
	</div>
</div>
<div style="clear:both;"></div>
<script type="text/javascript">
listTable.m = 'query';
listTable.divid = 'listDiv';
$("#btn_search").click(function(){
    listTable.filter['page'] =1;
    listTable.filter['user_name'] = $("#user_name").val();
    listTable.filter['appid'] = $("#appid").val();
    listTable.filter['appkey'] = $("#appkey").val();
    listTable.filter['start_time'] = $("#start_time").val();
    listTable.filter['end_time'] = $("#end_time").val();
    listTable.loadList();
});
    
var start = {
    elem: '#start_time',
    format: 'YYYY-MM-DD hh:mm:ss',
    min: laydate.now(), //设定最小日期为当前日期
    max: '2099-06-16 23:59:59', //最大日期
    istime: true,
    istoday: false,
    festival: true, //是否显示节日
    choose: function(datas){
         end.min = datas; //开始日选好后，重置结束日的最小日期
         end.start = datas; //将结束日的初始值设定为开始日
    }
};
var end = {
    elem: '#end_time',
    format: 'YYYY-MM-DD hh:mm:ss',
    min: laydate.now(),
    max: '2099-06-16 23:59:59',
    istime: true,
    istoday: false,
    festival: true, //是否显示节日
    choose: function(datas){
        start.max = datas; //结束日选好后，重置开始日的最大日期
    }
};
laydate(start);
laydate(end);
laydate.skin("yalan");
</script>
</body>
</html>
{/if}